class Solution:
    def permuteUnique(self, nums):
        results=[]
        def findset(prefix,indexs):
            if len(prefix)==len(nums) and prefix not in results:
                results.append(prefix[:])
                return 
            for i in range(len(nums)):
                if i not in indexs:
                    prefix.append(nums[i])
                    indexs.append(i)
                    findset(prefix,indexs)
                    prefix.pop(-1)
                    indexs.pop(-1)
        for i in range(len(nums)):
            findset([nums[i]],[i])
        return results

                

